package com.burstly.lib.exception;

import android.os.Debug;
import android.os.Environment;
import android.util.Log;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.Utils;
import java.io.File;
import java.io.IOException;

final class HeapFileDumpHandler
  implements Thread.UncaughtExceptionHandler
{
  private static final String DUMP_FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/burstly_oom_dump.hprof";
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private static final String TAG = "HeapFileDumpHandler";

  public void uncaughtException(Thread paramThread, Throwable paramThrowable)
  {
    Throwable localThrowable = paramThrowable.getCause();
    if (((paramThrowable instanceof OutOfMemoryError)) || ((localThrowable instanceof OutOfMemoryError)));
    for (int i = 1; ; i = 0)
    {
      if (i != 0)
        try
        {
          if (Utils.canWriteToSDCard())
          {
            Debug.dumpHprofData(DUMP_FILE_PATH);
            return;
          }
          LOG.logInfo("HeapFileDumpHandler", "Can not save heap dump file because SD card is not availale or it is read only.", new Object[0]);
          return;
        }
        catch (IOException localIOException)
        {
          LOG.logWarning("HeapFileDumpHandler", "Can not save heap dump file", new Object[0]);
          LOG.logWarning("HeapFileDumpHandler", Log.getStackTraceString(paramThrowable), new Object[0]);
        }
      return;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.exception.HeapFileDumpHandler
 * JD-Core Version:    0.6.2
 */